//
//  loginUserModel.m
//  news_ios_app
//
//  Created by fank on 16/3/19.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "loginUserModel.h"

@implementation loginUserModel

+(instancetype)modelWithDictionary:(NSDictionary *)dictionary
{
    loginUserModel *instance = [loginUserModel new];
    if (!dictionary) {
        return nil;
    }
    if (![dictionary isKindOfClass:[dictionary class]]) {
        return nil;
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"objectId"])) {
        instance.objectId = [dictionary objectForKey:@"objectId"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"username"])) {
        instance.username = [dictionary objectForKey:@"username"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"password"])) {
        instance.password = [dictionary objectForKey:@"password"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"mobilePhoneNumber"])) {
        instance.mobilePhoneNumber = [dictionary objectForKey:@"mobilePhoneNumber"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"email"])) {
        instance.email = [dictionary objectForKey:@"email"];
    }
    
    return instance;
}


- (NSDictionary *)modelToDict
{
    NSMutableDictionary *userDict = [NSMutableDictionary dictionary];
    if (!IsStrEmpty(self.mobilePhoneNumber)) {
    [userDict setObject:self.mobilePhoneNumber forKey:@"mobilePhoneNumber"];
    }
    if (!IsStrEmpty(self.email)) {
        [userDict setObject:self.email forKey:@"email"];
    }
    if (!IsStrEmpty(self.password)) {
        [userDict setObject:self.password forKey:@"password"];
    }
    if (!IsStrEmpty(self.username)) {
        [userDict setObject:self.username forKey:@"username"];
    }
    if (!IsStrEmpty(self.objectId)) {
        [userDict setObject:self.objectId forKey:@"objectId"];
    }
    return userDict;
}

@end
